package com.design.pattern.strategy.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * 
 * <p>Title: OptionServiceEnum.java</p>
 * <p>Description: 服务可选枚举</p>
 * <p>Copyright: Copyright (c) 2019</p>
 * <p>Company: www.swiftpass.cn</p>
 * @author lisheng
 * @date 2019年3月22日
 */
public enum OptionServiceEnum {

	DEFAULT("0000000", "DEFAULT");

	private final String code;
	private final String module;
	
    private OptionServiceEnum(String code, String module) {
    	this.module = module;
    	this.code = code;
    }

	public String getModule() {
		return module;
	}

	public String getCode() {
		return code;
	}
	
	public static String getModuleByCode(String code) {
		if (StringUtils.isEmpty(code)) {
			return null;
		}
		
		for (OptionServiceEnum value: OptionServiceEnum.values()) {
			if (StringUtils.equals(code, value.getCode())) {
				return value.getModule();
			}
		}
		
		return null;
	}
}
